package org.lebutch.sw.activity;

import org.lebutch.sw.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

public class HelpActivity extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		getWindow().requestFeature(Window.FEATURE_PROGRESS);

		setContentView(R.layout.help_tree);
		WebView webView = (WebView) findViewById(R.id.web);

		final Activity activity = this;
		webView.setWebChromeClient(new WebChromeClient() {
			@Override
			public void onProgressChanged(WebView view, int progress) {
				activity.setProgress(progress * 1000);
			}
		});
		webView.setWebViewClient(new WebViewClient() {
			@Override
			public void onReceivedError(WebView view, int errorCode,
					String description, String failingUrl) {
				Toast.makeText(activity,
						getResources().getString(R.string.error) + description,
						Toast.LENGTH_SHORT).show();
			}
		});

		webView.loadUrl("file:///android_asset/sw_tree.html");
	}
}
